package com.yxjx.duoxue.comment;

import com.yxjx.duoxue.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.RatingBar.OnRatingBarChangeListener;

public class MultiRatingBar extends LinearLayout {

	public MultiRatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs);
		
		View mRoot = LayoutInflater.from(context).inflate(R.layout.segment_multi_rating_bar, this, true);
		RatingBar mTotal = (RatingBar) mRoot.findViewById(R.id.rating_total).findViewById(R.id.rating);
		final View mDetail = mRoot.findViewById(R.id.rating_detail);
		
		mTotal.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
			
			@Override
			public void onRatingChanged(RatingBar arg0, float arg1, boolean arg2) {
				if (mDetail.getVisibility() != View.VISIBLE) {
					mDetail.setVisibility(View.VISIBLE);
				}
				
			}
		});
	}
	
	public MultiRatingBar(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}
	

}
